function talkialog(options){
			if(options.gridId){
				if(options.gridId && options.checkSelect==true){
					if(!options.queryParams){
						options.queryParams={};
					}
					if(options.gridType=='treegrid'){
						var idField =  jQuery("#"+options.gridId).treegrid('options').idField;
						var row = jQuery("#"+options.gridId).treegrid('getSelected');
						if(!row){
							parent.layer.msg("请选择一行数据",{icon:7,time:3000});
							return ;
						}
						//options.queryParams.id=row[idField];
						options.queryParams[idField]=row[idField];
					}else{
						var idField =  jQuery("#"+options.gridId).datagrid('options').idField;
						console.log(idField)
						var row = jQuery("#"+options.gridId).datagrid('getSelected');
						if(!row){
							parent.layer.msg("请选择一行数据",{icon:7,time:3000});
							return ;
						}
						options.queryParams[idField]=row[idField];
					}
				}
			}
			var dialog = document.createElement('div');
			dialog.style.cssText += " padding:10px 20px ";
			dialog.setAttribute("custom", "talk-dialog");
			dialog.setAttribute("id", "talk-dialog");
	        window.top.document.body.appendChild(dialog);
	        window.top.jQuery(dialog).dialog({
	        	width:options.width||'90%',
	        	height:options.height||'90%',
				title:options.title,
				modal:true,
				draggable:true,
				resizable:false,
				collapsible:true,
				minimizable:false,
				maximizable:true,
				//iconCls:'icon-grid',
				method:options.type||'post',
				href : options.url,	
				queryParams:options.queryParams,
				onBeforeDestroy:function(){
				}
				,onBeforeClose:function(){
					var frame = jQuery('iframe', this);
					if(frame.length>0){
		                try{//跨域会拒绝访问，这里处理掉该异常   
		                	frame[0].contentWindow.document.write('');
		                    frame[0].contentWindow.close();
		                }catch(e){
		                    //Do nothing   
		                }
		                frame.remove();
		                //IE9以上支持，ie6、7、8使用$.browser.msie
		                try{
		                	 if(jQuery.support.msie){
		                         CollectGarbage();
		                     }
		                }catch(e){
		                	if (window.CollectGarbage){
		                		CollectGarbage();
		                	}
		                }
			        }
				    window.top.jQuery(dialog).dialog('destroy');
					return true;
				}
				,onClose:options.onClose||function(){
				}
				,extractor: function(data){
					var pattern = /<body[^>]*>((.|[\n\r])*)<\/body>/im;
 					var matches = pattern.exec(data);
 					if (matches){
 						return matches[1];	// 仅提取主体内容
 					} else {
 						try{
 							dataJson = jQuery.parseJSON(data);
 							parent.layer.msg(dataJson.errorMessage,{icon:5,time:3000});
 							window.top.jQuery(dialog).dialog('close');
 						}catch(e){
 							
 						}
 					}
				}
			});
		}


//方法聊天窗口
function openWebChat(title,url,data,width,height){
	
	var dialog_id = "webchat" + (new Date().getTime());
	var request_url = url;
	if(data){
		request_url += "?";
		for(var p in data){
			var pair = p+"="+data[p]+"&";
			request_url += pair;
		}
		request_url = request_url.substr(0,request_url.length-1);
	}
	width="500px";
	height="300px";
	jQuery('body').append('<div id="'+dialog_id+'" style="width:'+width+';height:'+height+';overflow:hidden; "></div>');
	jQuery("#"+dialog_id).window({
			title:title,modal:false,inline:false,draggable:true,resizable:true,collapsible:true,minimizable:true,
			maximizable:true,closable:false,iconCls:'icon-grid',href:request_url,
			onMinimize:function(){
//				if(jQuery("#a"+dialog_id).size()>0){
//					jQuery("#a"+dialog_id).show(300);
//				}
//				else{
					var divmin = '<a href="javascript:void(0);" id="a'+dialog_id+'" onclick="javascript:jQuery(\'#'+dialog_id+'\').window(\'open\');jQuery(this).hide(300);" style="position:absolute;bottom:0px;right:0px;z-index:9;height:50px;width:50px" class="easyui-linkbutton error" data-options="iconCls:\'fa fa-commenting\'">'+title+'</a> ';
					jQuery('body').append(divmin);
//				}
			},
			onClose:function(){
			}
	});
	//默认最小化
	jQuery("#"+dialog_id).window('minimize');
}
